var pathJs = {
    'text': ['js/libs/require/text', "https://raw.githubusercontent.com/requirejs/text/latest/text.js"],
    'i18n': ['js/libs/require/i18n', "https://raw.githubusercontent.com/requirejs/i18n/latest/i18n.js"],

    "jquery": "js/libs/jquery-1.11.3",
    "md5": "js/libs/jquery.md5",
    'underscore': "js/libs/underscore-min",
    'backbone': "js/libs/backbone-min",

    'base': "js/common/base",
    'help': "js/common/help",
    'log': "js/common/log",
    "routes": "js/common/routes",
    'router': "js/common/router",
    'ajaxControl': "js/common/ajaxControl",

    'apiPathMapping': "js/system/apiPathMapping",

    'replacement': "js/system/replacement",
    'pageConfig': "js/common/dynamic/pageConfig",
    "nativeCommand": "js/common/dynamic/nativeCommand",

    'common': "js/common/common",
};

String.prototype.getPathMd5 = function (containsSelf) {
    var last = "";
    var url = this;
    if (url in window.fileTimeStamp) {
        last = "?" + window.fileTimeStamp[url];
    } else if (url.substring(1) in window.fileTimeStamp) {
        last = "?" + window.fileTimeStamp[url.substring(1)];
    } else {
        last = "?" + Date.now();
    }
    return (typeof containsSelf === "undefined") ? (url + last) : last;
};

require.config({
    i18n: {
        local: 'zh'
    },
    baseUrl: "",
    name: "",
    waitSceonds: 0,
    urlArgs: function (id, url) {
        return url.getPathMd5(false);
    },
    //	map: {
    //		"*": {
    //			"jquery": "js/libs/jquery-1.11.3"
    //		},
    //		"help": {
    //			"jquery": "js/libs/jquery-1.11.0"
    //		}
    //	},
    shim: {
        jquery: {
            exports: '$'
        },
        underscore: {
            exports: '_'
        },
        backbone: {
            deps: ['underscore', 'jquery'],
            exports: 'Backbone'
        },
        movieclip: {
            deps: ['jquery', 'createjs']
        }
    },
    paths: Object.assign({}, pathJs, {})
});

window.isDebug = true;
window.isLocalJson = true;
window.isOpenLog = true;

window.fileTimeStamp = {};
require(["replacement"], function (replacement) {
    var array = [];
    for (var i in replacement) {
        window.fileTimeStamp[i] = replacement[i];
        array.push(i);
    }
    require(array, function () {
        for (var i in arguments) {
            for (var j in arguments[i]) {
                window.fileTimeStamp[j] = arguments[i][j];
            }
        }
        require(["help", "jquery", "log", "base"], function (help) {
            help();
        });
    });
});